home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Cream of the Crop 1
/
Cream of the Crop 1.iso
/
MONITOR
/
COL_TEST.ARJ
/
TESTER.PRO
< prev
next >
Wrap
Text File
|
1992-02-06
|
14KB
|
624 lines
bgidriver "_SVGA256_driver_far"
code=1200
/****************************************************************************/
/* */
/* This is just a little routine that puts the screen colours in SVGA mode */
/* 640 by 480 by 256 up on the screen so you know what the colour numbers */
/* are in decimal format for your own programs. This information seems to */
/* be left out of all of the manuals for SVGA programming and I suppose a */
/* picture is worth a thousand words. There are also commented out */
/* routines in the source file that can be manipulated to perform other */
/* straight forward graphics functions under PDC Prolog */
/* */
/* Author : Steve Marett, All Rights Reserved, Copyright (c) 1992 */
/* */
/* Use of this program as compiled (TESTER.EXE) is free and I will not be */
/* liable for any damages whatsoever through use or misuse of the program */
/* or its associated code. */
/* */
/****************************************************************************/
DOMAINS
file = datafile
Ax,Bx,Cx,Dx,Si,Di,Ds,Es = integer
PREDICATES
mes_squares(integer,integer,integer,integer,integer,integer)
put_squares(integer,integer,integer,integer,integer)
do_looper(integer,integer)
initialise
draw_it(integer,integer,integer,integer,integer,integer,integer)
draw_palette(integer,integer,integer,integer,integer,integer,integer)
draw_random(real)
draw(integer,integer,integer,integer,integer)
random_line(real)
random_circle(real)
degrees_to_loc(real,real,real,real,real,real)
shift_stars(real,real)
random_stars(real)
random_star(real,real)
make_stars
do_shift(real,real,real,real)
show1(real,real)
show2(real,real,real,real)
show3(real,real,real,real,real,real)
show4(real,real,real,real,real,real,real,real)
show5(real,real,real,real,real,real,real,real,real,real)
show6(real,real,real,real,real,real,real,real,real,real,real,real)
show7(real,real,real,real,real,real,real,real,real,real,real,real,real,real)
do_back(real)
/*
include "BGI.PRE"
*/
GOAL
initialise.
/**------------------------------------------------------------------------**/
/** CLAUSES BODY **/
/**------------------------------------------------------------------------**/
CLAUSES
INITIALISE if
clearwindow,
Ba=11,Fc=2,
initgraph(Ba,Fc,_,_,""),
/* setgraphmode(Fc),
IntNo1=$0A,Axi=$005D,
bios(IntNo1,reg(Axi,0,0,0,0,0,0,0),reg(Axo,_,_,_,_,_,_,_),Flag1),
bios(IntNo1,reg(AXi,0,0,0,0,0,0,0),reg(_,_,_,_,_,_,_,_),Flag2),
IntNo2=$14,
bios(IntNo2,reg(AXi,0,0,0,0,0,0,0),reg(_,_,_,_,_,_,_,_),Flag3),
setwritemode(0),
*/ getgraphmode(X),
getmaxcolor(Y),
getpalettesize(Z),
getmaxx(Aa),
getmaxy(Ab),
moveto(0,0),
write(" Present Driver = ",Ba),nl,
write(" Present Mode = ",Fc),nl,
write(" New Mode = ",X),nl,
write("Maximum Colours = ",Y),nl,
write(" Pallete Size = ",Z),nl,
write(" Screen Size = ",Aa," by ",Ab),nl,
readchar(_),
setvisualpage(0),
cleardevice,
setactivepage(1),
cleardevice,
moveto(0,0),
/* write("What character increment --> "),readln(Vua),
str_int(Vua,Valuex),
*/ mes_squares(1,0,0,0,39,29),
cleardevice,
mes_squares(1,0,0,0,39,29),
/* do_looper(0,Valuex),
draw(0,0,639,0,0),
draw_it(0,0,639,0,0),
setwritemode(0),
draw_random(0),
readchar(_),
setlinestyle(0,$FFFF,3),
setcolor(12),
rectangle(50,100,400,150),
readchar(_),
setfillstyle(1,12),
floodfill(55,105,12),
readchar(_),
bar3d(50,200,400,250,20,110),
readchar(_),
cleardevice,
setlinestyle(0,$FFFF,1),
random_line(0),
readchar(_),
cleardevice,
setactivepage(0),
setvisualpage(0),
setwritemode(0),
setlinestyle(0,$FFFF,3),
setbkcolor(0),
do_back(0),
setfillstyle(1,4),
setcolor(4),
circle(319,239,5),
floodfill(319,239,4),
setlinestyle(0,$FFFF,1),
make_stars,
random_circle(0),
readchar(_),
cleardevice,
setlinestyle(0,$FFFF,1),
degrees_to_loc(0,1),
*/ setvisualpage(0),
setvisualpage(1),
readchar(_),
closegraph,
clearwindow,
exit.
DO_LOOPER(X,Valuex) if
Xa=X+1,
X < 1,!,
cleardevice,
write("This is spacing by ",X),
readchar(_),
cleardevice,
draw_it(0,0,639,0,0,X,Valuex),
readchar(_),
do_looper(Xa,Valuex).
DO_LOOPER(_,_) if !.
DRAW(A,B,C,D,E) if
Ea=E+1,
Ba=B+1,
Ba < 256,!,
setbkcolor(0),
setcolor(E),
line(A,B,C,D),
draw(A,Ba,C,Ba,Ea).
DRAW(_,_,_,_,_) if !.
DRAW_IT(A,B,C,D,E,Value,Valuex) if
Ea = E + Valuex,
Ba = B + 1,
Ba < 256,!,
setbkcolor(0),
Ya=E,
draw_palette(A,B,C,D,Ya,1,Value),
draw_it(A,Ba,C,Ba,Ea,Value,Valuex).
DRAW_IT(_,_,_,_,_,_,_) if !.
DRAW_PALETTE(A,B,C,D,X,Y,Value) if
Xa=X+0,
Ya = Y - 1,
Xa < 256,
Ya > - 1,!,
Ba = B + 1,
setcolor(X),
line(A,B,C,D),
draw_palette(A,Ba,C,Ba,Xa,Ya,Value).
DRAW_PALETTE(_,_,_,_,_,_,_) if !.
DRAW_RANDOM(A) if
Aa=A+1,
Aa < 5000,!,
random(50,X),
random(50,Y),
random(255,Z),
putpixel(X,Y,Z),
draw_random(Aa).
DRAW_RANDOM(_) if !.
RANDOM_LINE(A) if
Aa=A+1,
Aa < 1000,!,
random(639,X),
random(479,Y),
random(639,Xa),
random(479,Ya),
random(255,Z),
setcolor(Z),
line(X,Y,Xa,Ya),
random_line(Aa).
RANDOM_LINE(_) if !.
RANDOM_CIRCLE(A) if
Aa=A+1,
Aa < 50,!,
random(639,X),
random(479,Y),
random(100,Xa),
random(14,Z),
random(14,Za),
Zb=Za+1,
/* Zc=Z+1,
setcolor(Zc),
circle(X,Y,Xa),
*/ degrees_to_loc(X,Y,Xa,Zb,0,16),
random_circle(Aa).
RANDOM_CIRCLE(_) if !.
DEGREES_TO_LOC(X,Y,Xa,Za,Start,End) if
setcolor(0),
Xb=Xa+25,
arc(X,Y,Start,End,Xb),
getarccoords(_,_,_,_,Xend,Yend),
setcolor(End),
line(X,Y,Xend,Yend),
Start_new = End,
End_new = End + 1,
Start_new < 180,!,
degrees_to_loc(X,Y,Xa,Za,Start_new,End_new).
DEGREES_TO_LOC(_,_,_,_,_,_) if !.
MAKE_STARS if
random(10,Z),
Za=Z+6,
random_stars(Za),!,
make_stars.
MAKE_STARS if make_stars.
MAKE_STARS if !,make_stars.
RANDOM_STAR(Xa1,Ya1) if
random(60,X1),
random(20,Y1),
Xa1=X1+289,
Ya1=Y1+229.
DO_SHIFT(X1,Y1,Xa1,Ya1) if
X1 < 319, Y1 < 239,
Xa1=((X1-0)-((319-X1)*2)),Ya1=((Y1-0)-((239-Y1)*2)),
Y1 > -1,!,
shift_stars(X1,Y1).
DO_SHIFT(X1,Y1,Xa1,Ya1) if
X1 > 318, Y1 < 239,
Xa1=((X1-0)+((X1-319)*2)),Ya1=((Y1-0)-((239-Y1)*2)),
Y1 > -1,!,
shift_stars(X1,Y1).
DO_SHIFT(X1,Y1,Xa1,Ya1) if
X1 < 319, Y1 > 238,
Xa1=((X1-0)-((319-X1)*2)),Ya1=((Y1-0)+((Y1-239)*2)),
X1 > -1,
Y1 < 480,!,
shift_stars(X1,Y1).
DO_SHIFT(X1,Y1,Xa1,Ya1) if
X1 > 318, Y1 > 238,
Xa1=((X1-0)+((X1-319)*2)),Ya1=((Y1-0)+((Y1-239)*2)),
X1 < 640,
Y1 < 480,!,
shift_stars(X1,Y1).
DO_SHIFT(_,_,0,0) if !.
SHOW1(X1,Y1) if
do_shift(X1,Y1,Xa1,Ya1),
Ya1 > -1,!,
show1(Xa1,Ya1).
SHOW1(_,_) if !.
SHOW2(X1,Y1,X2,Y2) if
do_shift(X1,Y1,Xa1,Ya1),
do_shift(X2,Y2,Xa2,Ya2),
Ya1+Ya2 > -1,!,
show2(Xa1,Ya1,Xa2,Ya2).
SHOW2(_,_,_,_) if !.
SHOW3(X1,Y1,X2,Y2,X3,Y3) if
do_shift(X1,Y1,Xa1,Ya1),
do_shift(X2,Y2,Xa2,Ya2),
do_shift(X3,Y3,Xa3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a3,Ya3),
do_shift(X4,Y4,Xa4,Ya4),
do_shift(X5,Y5,Xa5,Ya5),
do_shift(X6,Y6,Xa6,Ya6),
do_shift(X7,Y7,Xa7,Ya7),
Ya1+Ya2+Ya3+Ya4+Ya5+Ya6+Ya7 > -1,!,
show7(Xa1,Ya1,Xa2,Ya2,Xa3,Ya3,Xa4,Ya4,Xa5,Ya5,Xa6,Ya6,Xa7,Ya7).
SHOW7(_,_,_,_,_,_,_,_,_,_,_,_,_,_) if !.
RANDOM_STARS(1) if
random_star(X1,Y1),
show1(X1,Y1).
RANDOM_STARS(2) if
random_star(X1,Y1),
random_star(X2,Y2),
show2(X1,Y1,X2,Y2).
RANDOM_STARS(3) if
random_star(X1,Y1),
random_star(X2,Y2),
random_star(X3,Y3),
show3(X1,Y1,X2,Y2,X3,Y3).
RANDOM_STARS(4) if
random_star(X1,Y1),
random_star(X2,Y2),
random_star(X3,Y3),
random_star(X4,Y4),
show4(X1,Y1,X2,Y2,X3,Y3,X4,Y4).
RANDOM_STARS(5) if
random_star(X1,Y1),
random_star(X2,Y2),
random_star(X3,Y3),
random_star(X4,Y4),
random_star(X5,Y5),
show5(X1,Y1,X2,Y2,X3,Y3,X4,Y4,X5,Y5).
RANDOM_STARS(6) if
random_star(X1,Y1),
random_star(X2,Y2),
random_star(X3,Y3),
random_star(X4,Y4),
random_star(X5,Y5),
random_star(X6,Y6),
show6(X1,Y1,X2,Y2,X3,Y3,X4,Y4,X5,Y5,X6,Y6).
RANDOM_STARS(7) if
random_star(X1,Y1),
random_star(X2,Y2),
random_star(X3,Y3),
random_star(X4,Y4),
random_star(X5,Y5),
random_star(X6,Y6),
random_star(X7,Y7),
show7(X1,Y1,X2,Y2,X3,Y3,X4,Y4,X5,Y5,X6,Y6,X7,Y7).
RANDOM_STARS(_) if !.
SHIFT_STARS(X1,Y1) if
X1 < 319, Y1 < 239,!,
Xa1=((X1-0)-((319-X1)*2)),Ya1=((Y1-0)-((239-Y1)*2)),
putpixel(X1,Y1,0),
/* Ya1 > -1,!,
*/ putpixel(Xa1,Ya1,15).
SHIFT_STARS(X1,Y1) if
X1 > 318, Y1 < 239,!,
Xa1=((X1-0)+((X1-319)*2)),Ya1=((Y1-0)-((239-Y1)*2)),
putpixel(X1,Y1,0),
/* Ya1 > -1,!,
*/ putpixel(Xa1,Ya1,14).
SHIFT_STARS(X1,Y1) if
X1 < 319, Y1 > 238,!,
Xa1=((X1-0)-((319-X1)*2)),Ya1=((Y1-0)+((Y1-239)*2)),
putpixel(X1,Y1,0),
/* Ya1 < 480,!,
*/ putpixel(Xa1,Ya1,12).
SHIFT_STARS(X1,Y1) if
X1 > 318, Y1 > 238,!,
Xa1=((X1-0)+((X1-319)*2)),Ya1=((Y1-0)+((Y1-239)*2)),
putpixel(X1,Y1,0),
/* Ya1 < 480,!,
*/ putpixel(Xa1,Ya1,11).
SHIFT_STARS(_,_) if !.
DO_BACK(Count) if
Countx=Count+1,
Countx < 50,!,
random(639,X),
random(479,Y),
random(14,Z),
Za=Z+1,
putpixel(X,Y,Za),
do_back(Countx).
DO_BACK(_) if !.
MES_SQUARES(1,X,A,B,C,D) if
X < 16,!,
put_squares(X,A,B,C,D),
Aa=A+40,Ca=C+40,
Xa=X+1,
mes_squares(1,Xa,Aa,B,Ca,D).
MES_SQUARES(1,X,_,_,_,_) if !,
mes_squares(2,X,0,30,40,59).
MES_SQUARES(2,X,A,B,C,D) if
X < 32,!,
put_squares(X,A,B,C,D),
Aa=A+40,Ca=C+40,
Xa=X+1,
mes_squares(2,Xa,Aa,B,Ca,D).
MES_SQUARES(2,X,_,_,_,_) if !,
mes_squares(3,X,0,60,40,89).
MES_SQUARES(3,X,A,B,C,D) if
X < 48,!,
put_squares(X,A,B,C,D),
Aa=A+40,Ca=C+40,
Xa=X+1,
mes_squares(3,Xa,Aa,B,Ca,D).
MES_SQUARES(3,X,_,_,_,_) if !,
mes_squares(4,X,0,90,40,119).
MES_SQUARES(4,X,A,B,C,D) if
X < 64,!,
put_squares(X,A,B,C,D),
Aa=A+40,Ca=C+40,
Xa=X+1,
mes_squares(4,Xa,Aa,B,Ca,D).
MES_SQUARES(4,X,_,_,_,_) if !,
mes_squares(5,X,0,120,40,149).
MES_SQUARES(5,X,A,B,C,D) if
X < 80,!,
put_squares(X,A,B,C,D),
Aa=A+40,Ca=C+40,
Xa=X+1,
mes_squares(5,Xa,Aa,B,Ca,D).
MES_SQUARES(5,X,_,_,_,_) if !,
mes_squares(6,X,0,150,40,179).
MES_SQUARES(6,X,A,B,C,D) if
X < 96,!,
put_squares(X,A,B,C,D),
Aa=A+40,Ca=C+40,
Xa=X+1,
mes_squares(6,Xa,Aa,B,Ca,D).
MES_SQUARES(6,X,_,_,_,_) if !,
mes_squares(7,X,0,180,40,209).
MES_SQUARES(7,X,A,B,C,D) if
X < 112,!,
put_squares(X,A,B,C,D),
Aa=A+40,Ca=C+40,
Xa=X+1,
mes_squares(7,Xa,Aa,B,Ca,D).
MES_SQUARES(7,X,_,_,_,_) if !,
mes_squares(8,X,0,210,40,239).
MES_SQUARES(8,X,A,B,C,D) if
X < 128,!,
put_squares(X,A,B,C,D),
Aa=A+40,Ca=C+40,
Xa=X+1,
mes_squares(8,Xa,Aa,B,Ca,D).
MES_SQUARES(8,X,_,_,_,_) if !,
mes_squares(9,X,0,240,40,269).
MES_SQUARES(9,X,A,B,C,D) if
X < 144,!,
put_squares(X,A,B,C,D),
Aa=A+40,Ca=C+40,
Xa=X+1,
mes_squares(9,Xa,Aa,B,Ca,D).
MES_SQUARES(9,X,_,_,_,_) if !,
mes_squares(10,X,0,270,40,299).
MES_SQUARES(10,X,A,B,C,D) if
X < 160,!,
put_squares(X,A,B,C,D),
Aa=A+40,Ca=C+40,
Xa=X+1,
mes_squares(10,Xa,Aa,B,Ca,D).
MES_SQUARES(10,X,_,_,_,_) if !,
mes_squares(11,X,0,300,40,329).
MES_SQUARES(11,X,A,B,C,D) if
X < 176,!,
put_squares(X,A,B,C,D),
Aa=A+40,Ca=C+40,
Xa=X+1,
mes_squares(11,Xa,Aa,B,Ca,D).
MES_SQUARES(11,X,_,_,_,_) if !,
mes_squares(12,X,0,330,40,359).
MES_SQUARES(12,X,A,B,C,D) if
X < 192,!,
put_squares(X,A,B,C,D),
Aa=A+40,Ca=C+40,
Xa=X+1,
mes_squares(12,Xa,Aa,B,Ca,D).
MES_SQUARES(12,X,_,_,_,_) if !,
mes_squares(13,X,0,360,40,389).
MES_SQUARES(13,X,A,B,C,D) if
X < 208,!,
put_squares(X,A,B,C,D),
Aa=A+40,Ca=C+40,
Xa=X+1,
mes_squares(13,Xa,Aa,B,Ca,D).
MES_SQUARES(13,X,_,_,_,_) if !,
mes_squares(14,X,0,390,40,419).
MES_SQUARES(14,X,A,B,C,D) if
X < 224,!,
put_squares(X,A,B,C,D),
Aa=A+40,Ca=C+40,
Xa=X+1,
mes_squares(14,Xa,Aa,B,Ca,D).
MES_SQUARES(14,X,_,_,_,_) if !,
mes_squares(15,X,0,420,40,449).
MES_SQUARES(15,X,A,B,C,D) if
X < 240,!,
put_squares(X,A,B,C,D),
Aa=A+40,Ca=C+40,
Xa=X+1,
mes_squares(15,Xa,Aa,B,Ca,D).
MES_SQUARES(15,X,_,_,_,_) if !,
mes_squares(16,X,0,450,40,479).
MES_SQUARES(16,X,A,B,C,D) if
X < 256,!,
put_squares(X,A,B,C,D),
Aa=A+40,Ca=C+40,
Xa=X+1,
mes_squares(16,Xa,Aa,B,Ca,D).
MES_SQUARES(_,_,_,_,_,_) if !.
PUT_SQUARES(X,A,B,C,D) if
setlinestyle(0,$FFFF,3),
setfillstyle(1,X),
setcolor(17),
rectangle(A,B,C,D),
Aa = A + 4,Ba = B + 4,
floodfill(Aa,Ba,17),
Ab = A + 10,Bb = B + 12,
str_int(Xa,X),
setcolor(0),
outtextxy(Ab,Bb,Xa).